<?php

header("Content-Type:text/html;charset=UTF-8");
require_once '../libs/functions.php';
$conn = &ADONewConnection('mysqli');
$conn->debug = true;

$conn->Connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // or die( $conn->ErrorMsg() ); 
$conn->Execute('SET NAMES UTF8');



$query = "SELECT * FROM `bus_option` ;";

// 以栏存取
$ADODB_FETCH_MODE = ADODB_FETCH_ASdSOC;
// 依顺序存取
//$ADODB_FETCH_MODE = ADODB_FETCH_NUM;


$re = dbGetListByProcedure($conn ,"CALL bus_info(100032)");
$top =array();
foreach($re as $t){
	array_push($top,array('uid' => $t['uid'],
							'kbao1' => $t['kbao1'], 'kbao2' => $t['kbao2'],
							'kbi1' => $t['kbi1'], 'kbi2' => $t['kbi2'] )
	);
}
var_dump($top);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(function(){// dom元素加载完毕
	$('#btn').click(function(){ //获取id为btn的元素,给它添加onclick事件
	    var items =  $("input[name='check']:checked"); 
		//获取name为check的一组元素,然后选取它们中选中(checked)的。
	   	alert( "选中的个数为："+items.length  );

	   	$.each(items,function(i,n){
			alert( $(n).val() );
		   	});
	});



















$.each(data['list'], function(i,n){
	var trmsg = '';
	if(i%2 == 0){
		trmsg = "<tr bgcolor=\"#3676B4\" align=\"center\">";
	}else {
		trmsg = "<tr align=\"center\">";
	}
	
	trmsg += "<td align=\"center\" height=\"25\" width=\"35\"><input name=\"checkbox\" type=\"checkbox\" ";
	if(n['status'] == 0){
		trmsg += " value=\""+ n['bus_id'] +"\" />"; 
	}else{
		trmsg += " disabled=\"true\" value=\""+ n['bus_id'] +"\" />";
	}
	
	trmsg += "</td><td width=\"40\">";
	if(n['flag'] == 3){
		trmsg += "买";
	}else{n['flag'] == 3){
		trmsg += "卖";
	}
	trmsg += "</td><td width=\"85\">" +n['bus_id']+ "</td>";
			+ "<td width=\"80\">" +n['num_left']+'/'+n['num']+ "</td>"
			+ "<td width=\"100\">" +n['price']+ "K币</td>"
			+ "<td width=\"150\">" +n['time']+ "</td>"
			+ "<td width=\"55\" ";

	if(n['status'] == 0){
		trmsg += " >未成交</td></tr>";
	}else if(n['status'] == 1){
		trmsg += " class=\"blue2\">成交</td></tr>"; 
	}else if(n['status'] == 2){
		trmsg += " class=\"blue2\">撤单</td></tr>"; 
	}else{
		trmsg += " >出错</td></tr>";
	}

	$("#listKb").prepend( trmsg );
});

























});
</script>

</head>
<body>

<input type="checkbox" value="1" name="check" checked/>
<input type="checkbox" value="2" name="check" />
<input type="checkbox" value="3" name="check" checked/>
<input type="button" value="测试选中的个数" id="btn"/>




<table id="listTrust" width="545" border="0" cellspacing="0" cellpadding="0">
	<tr align="center">
         <td width="35" height="24"><span class="STYLE3 blue2">选择</span></td>
         <td width="40"><span class="STYLE3 blue2">业务</span></td>
         <td width="85"><span class="STYLE3 blue2">委托号</span></td>
         <td width="80"><span class="STYLE3 blue2">成交/挂单数</span></td>
         <td width="100"><span class="STYLE3 blue2">K宝单价(K币)</span></td>
         <td width="150"><span class="STYLE3 blue2">挂单日期</span></td>
         <td width="55"><span class="blue2">状态</span></td>
    </tr>
</table>

<table id="listDeal" width="780" border="0" cellspacing="0" cellpadding="0">
	<tr align="center">
        <td width="35" height="24"><span class="STYLE3 blue2">选择</span></td>
        <td width="40"><span class="STYLE3 blue2">业务</span></td>
        <td width="85"><span class="STYLE3 blue2">委托号</span></td>
        <td width="85"><span class="STYLE3 blue2">交易号</span></td>
        <td width="50"><span class="STYLE3 blue2">成交数</span></td>
        <td width="100"><span class="STYLE3 blue2">K宝单价(K币)</span></td>
        <td width="120">成交总额</td>
        <td width="210"><span class="STYLE3 blue2">挂单日期</span></td>
        <td width="55"><span class="blue2">状态</span></td>
	</tr>
</table>
  
</body></html>